import header_src from '../../assets/images/header.svg'
import styles from './css/index.module.css';
const url = "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png";
import { Avatar, Dropdown, Space, } from 'antd';
import { useNavigate } from 'react-router-dom'

import { DownOutlined } from '@ant-design/icons';
const items = [
    {
        label: ' 退出 ',
        key: '0',
    },
    {
        label: ' 待定 ',
        key: '1',
    },
    {
        label: '占位置',
        key: '2',
    },
];

const HeaderTop = () => {
    const Navigate = useNavigate();
    const handleDropdownItemClick = ({ key }) => {
        if (key === '0') {
            Navigate('/login');
            sessionStorage.clear();
        }
    }
    return (
        <section className={styles.headerTop}>
  
            <div className={styles.loginout}>

                <Avatar src={<img src={url} alt="avatar" />} />
                <span className={styles.nbsp}></span>
                <Dropdown
                    menu={{
                        items,
                        onClick: handleDropdownItemClick,
                    }}
                    size="large"
                    trigger={['click']}
                >
                    <a onClick={(e) => e.preventDefault()}>
                        <Space>
                            甘小姐
                            <DownOutlined />
                        </Space>
                    </a>
                </Dropdown>
            </div>
        </section>
    )
}

export default HeaderTop;